<template>
	<u-popup v-model.sync="showbtn" mode="bottom" border-radius="30" :mask-close-able="closeAble">
		<view class="corporate-name">安顺职院 申请</view>
		<view class="title">获取您的用户信息</view>
		<view class="title-tips">您的用户信息将用于小程序注册</view>
		<view class="title-btn">
			<u-button size="medium" :custom-style="refuseStyle" @click="refuseHandler">拒绝</u-button>
			<u-button type="success" size="medium" :custom-style="allowStyle" open-type="getUserInfo" @getuserinfo="getuserInfo">允许</u-button>
		</view>
	</u-popup>
</template>

<script>
	export default{
		props:{
			showbtn:{//是否开启用户授权提示 false:默认关闭，true:开启
				type:Boolean,
				default:false
			}
		},
		data(){
			return{
				// myShowbtn:this.showbtn
				closeAble:false
			}
		},
		methods:{
			getuserInfo() { // 用户允许授权
				uni.getUserInfo({
					success: (res) => {
						this.$emit("allowGetUserInfo",res)
						// this.myShowbtn = false
						this.$emit("update:showbtn",false)
					}
				})
			},
			refuseHandler() { //用户拒绝授权
				// this.myShowbtn = false
				this.$emit("update:showbtn",false)
			},
		}
	}
</script>

<style lang="scss" scoped>
	.corporate-name {
		margin: 20px 0 0 20px;
		font-size: 18px;
		color: #0D0D0D;
	}
		
	.title {
		margin: 20px 0 0 20px;
		font-size: 20px;
		color: #000000;
	}
		
	.title-tips {
		margin: 10px 0 0 20px;
		font-size: 16px;
		color: #959595;
	}
		
	.title-btn {
		display: flex;
		justify-content: space-around;
		align-items: center;
		height: 150rpx;
	}
</style>
